<!-- catalog/templates/catalog/author_list.html -->
{% extends "base_generic.html" %}

{% block content %}
    <h1>作者列表</h1>

    {% if author_list %}
    <ul>
        {% for author in author_list %}
        <li>
            <a href="{% url 'author-detail' author.pk %}">{{ author.last_name }}, {{ author.first_name }}</a>
            {% if author.date_of_birth %}
            ({{ author.date_of_birth }} -
            {% if author.date_of_death %}{{ author.date_of_death }}{% else %}至今{% endif %})
            {% endif %}
        </li>
        {% endfor %}
    </ul>

    {% if is_paginated %}
        <div class="pagination">
            <span class="page-links">
                {% if page_obj.has_previous %}
                    <a href="{% url 'authors' %}?page={{ page_obj.previous_page_number }}">上一页</a>
                {% endif %}
                <span class="page-current">
                    第 {{ page_obj.number }} 页，共 {{ paginator.num_pages }} 页
                </span>
                {% if page_obj.has_next %}
                    <a href="{% url 'authors' %}?page={{ page_obj.next_page_number }}">下一页</a>
                {% endif %}
            </span>
        </div>
    {% endif %}

    {% else %}
        <p>没有找到作者。</p>
    {% endif %}
{% endblock %}
